module enqueueMuxer8 (
    input wire clk,
    input wire rst,
    input wire queue_en_1,
    input wire [5:0] enqueue_priority_1,
    input wire [9:0] enqueue_index_1,
    input wire queue_en_2,
    input wire [5:0] enqueue_priority_2,
    input wire [9:0] enqueue_index_2,
    input wire queue_en_3,
    input wire [5:0] enqueue_priority_3,
    input wire [9:0] enqueue_index_3,
    input wire queue_en_4,
    input wire [5:0] enqueue_priority_4,
    input wire [9:0] enqueue_index_4,
    input wire queue_en_5,
    input wire [5:0] enqueue_priority_5,
    input wire [9:0] enqueue_index_5,
    input wire queue_en_6,
    input wire [5:0] enqueue_priority_6,
    input wire [9:0] enqueue_index_6,
    input wire queue_en_7,
    input wire [5:0] enqueue_priority_7,
    input wire [9:0] enqueue_index_7,
    input wire queue_en_8,
    input wire [5:0] enqueue_priority_8,
    input wire [9:0] enqueue_index_8,
    output wire [7:0] enqueue_arbitration,
    output reg enqueue_out,
    output reg [5:0] enqueue_priority_out,
    output reg [9:0] enqueue_index_out,
    output reg [5:0] enqueue_where_out
);  

    
    always @(posedge clk) begin
        //将输出信号进行复位
        if (rst) begin
            enqueue_out <= 1'b0;
            enqueue_priority_out <= 0;
        end

        if (enqueue_arbitration == 8'b00000001) begin
            enqueue_out <= 1'b1;
            enqueue_priority_out <= enqueue_priority_1;
            enqueue_index_out <= enqueue_index_1;
            enqueue_where_out <= 1;
        end

        if (enqueue_arbitration == 8'b00000010) begin
            enqueue_out <= 1'b1;
            enqueue_priority_out <= enqueue_priority_2;
            enqueue_index_out <= enqueue_index_2;
            enqueue_where_out <= 2;
        end

        if (enqueue_arbitration == 8'b00000100) begin
            enqueue_out <= 1'b1;
            enqueue_priority_out <= enqueue_priority_3;
            enqueue_index_out <= enqueue_index_3;
            enqueue_where_out <= 3;
        end

        if (enqueue_arbitration == 8'b00001000) begin
            enqueue_out <= 1'b1;
            enqueue_priority_out <= enqueue_priority_4;
            enqueue_index_out <= enqueue_index_4;
            enqueue_where_out <= 4;
        end

        if (enqueue_arbitration == 8'b00010000) begin
            enqueue_out <= 1'b1;
            enqueue_priority_out <= enqueue_priority_5;
            enqueue_index_out <= enqueue_index_5;
            enqueue_where_out <= 5;
        end

        if (enqueue_arbitration == 8'b00100000) begin
            enqueue_out <= 1'b1;
            enqueue_priority_out <= enqueue_priority_6;
            enqueue_index_out <= enqueue_index_6;
            enqueue_where_out <= 6;
        end

        if (enqueue_arbitration == 8'b01000000) begin
            enqueue_out <= 1'b1;
            enqueue_priority_out <= enqueue_priority_7;
            enqueue_index_out <= enqueue_index_7;
            enqueue_where_out <= 7;
        end

        if (enqueue_arbitration == 8'b10000000) begin
            enqueue_out <= 1'b1;
            enqueue_priority_out <= enqueue_priority_8;
            enqueue_index_out <= enqueue_index_8;
            enqueue_where_out <= 8;
        end

        if (enqueue_arbitration == 8'b00000000) begin
            enqueue_out <= 1'b0;
        end
    end


    enqueueArbiter8 enqueueArb(.queue_en_1(queue_en_1), .data_priority_1(enqueue_priority_1),
                                .queue_en_2(queue_en_2), .data_priority_2(enqueue_priority_2),
                                .queue_en_3(queue_en_3), .data_priority_3(enqueue_priority_3), 
                                .queue_en_4(queue_en_4), .data_priority_4(enqueue_priority_4),
                                .queue_en_5(queue_en_5), .data_priority_5(enqueue_priority_5), 
                                .queue_en_6(queue_en_6), .data_priority_6(enqueue_priority_6),
                                .queue_en_7(queue_en_7), .data_priority_7(enqueue_priority_7), 
                                .queue_en_8(queue_en_8), .data_priority_8(enqueue_priority_8), .queue_arbitration(enqueue_arbitration));

endmodule